package top.suven.base.http.enums;

/**
 * @ClassName:
 * @Description:
 * @Author aric
 * @Date 2018/5/29 下午4:10
 * @Copyright: (c) 2018 gc by https://www.gc.com.cn/
 * @Version : 1.0.0
 * --------------------------------------------------------
 * modifyer    modifyTime                 comment
 * <p>
 * --------------------------------------------------------
 */
public enum StatusEnum {

    VALID(1,"有效"),INVALID(0,"无效");

    int index;
    String name;
    public int getIndex() {
        return index;
    }
    public String getName() {
        return name;
    }


    StatusEnum(int index, String name) {
        this.index = index;
        this.name = name;
    }

    public static StatusEnum getByIndex(int index) {
        for(StatusEnum typeEnum : StatusEnum.values()) {
            if(typeEnum.index==index) {
                return typeEnum;
            }
        }
        throw new IllegalArgumentException("No element matches " + index);
    }

}
